package com.itheima.work01;

import java.util.TreeSet;

public class Teacher implements Comparable<Teacher>{
    private String id;
    private String name;

    private TreeSet<Student> tsStudent = new TreeSet<>();

    public Teacher() {
    }

    public Teacher(String id, String name, TreeSet<Student> tsStudent) {
        this.id = id;
        this.name = name;
        this.tsStudent = tsStudent;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public TreeSet<Student> getTsStudent() {
        return tsStudent;
    }

    public void setTsStudent(TreeSet<Student> tsStudent) {
        this.tsStudent = tsStudent;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", tsStudent=" + tsStudent +
                '}';
    }

    @Override
    public int compareTo(Teacher o) {
        int i = this.getId().compareTo(o.getId());
        i=i==0?o.getName().compareTo(this.getName()):i;
        return i;
    }
}
